------ utility functions for complex numbers ------
-- Arrays can be used to represent complex numbers. Addition, subtraction and multiplication by a real can be done directly. The following functions implement other basic operations on complex numbers.

Creal(r) = {r,0}  -- create a complex from a real
Cabs(A) = sqrt(A[1]^2+A[2]^2)
Cmult(A,B) = {A[1]*B[1]-A[2]*B[2],A[2]*B[1]+A[1]*B[2]}
Csqr(A) = {A[1]*A[1]-A[2]*A[2],2*A[1]*A[2]}
Ccube(A) = Cmult(A,Csqr(A))
Cdiv(A,B)={(B[1]*A[1]+B[2]*A[2])/(B[1]^2+B[2]^2),
         (B[1]*A[2]-B[2]*A[1])/(B[1]^2+B[2]^2)}
Conj(A) = {A[1],-A[2]}
Carg(A) = 0 when A[1]=0 and A[2]=0, atan2(A[2],A[1])
